#!/usr/bin/expect

spawn build/bin/observer -f etc/observer.ini -P cli 
expect "miniob >"
send "drop table date_table\r"
expect "miniob >"
send "CREATE TABLE date_table(id int, u_date date);\r"
expect "miniob >"
send "CREATE unique INDEX index_id on date_table(u_date);\r"
expect "miniob >"
send "INSERT INTO date_table VALUES (1,'2020-01-21')\r"
expect "miniob >"
send "INSERT INTO date_table VALUES (2,'2020-10-21');\r"
expect "miniob >"
send "INSERT INTO date_table VALUES (3,'2020-1-01');\r"
expect "miniob >"
send "INSERT INTO date_table VALUES (4,'2020-1-01');\r"
expect "miniob >"
send "update date_table set u_date='2020-1-1' where id=1;\r"
expect "miniob >"
send "update date_table set u_date='2020-1-15' where id=1;\r"
expect "miniob >"
send "update date_table set id=100 where u_date='2020-1-15';\r"
expect "miniob >"
send "select * from date_table\r"
interact